package com.liteng.shadow.core.utils;

import com.google.gson.Gson;

import java.lang.reflect.Type;

public class JsonUtil {
    private static final Gson gson = new Gson();

    public static String toJson(Object src){
        return gson.toJson(src);
    }

    public <T> T fromJson(String json, Class<T> classOfT){
        return gson.fromJson(json, classOfT);
    }

    public <T> T fromJson(String json, Type typeOfT){
        return gson.fromJson(json, typeOfT);
    }
}
